package li.buda.config {
import mx.messaging.ChannelSet;
import mx.messaging.channels.AMFChannel;
import mx.rpc.remoting.RemoteObject;

public class RemoteObjectFactory {

    public static function create():RemoteObject {
        var ro:RemoteObject = new RemoteObject();
        ro.channelSet = channelSet;
        return ro;
    }

    private static var _channelSet:ChannelSet;
    private static function get channelSet():ChannelSet {
        if (_channelSet == null) {
            _channelSet = new ChannelSet();
            var chan:AMFChannel = new AMFChannel("amf", "http://127.0.0.1:8080/module/messagebroker/amf");
            chan.pollingEnabled = false;
            _channelSet.addChannel(chan);
        }
        return _channelSet;
    }

    function RemoteObjectFactory() {
    }
}
}